Interfaces in the Rotor

The implementation of the interfaces in the Rotor was a new technique in my experience. Probably the same method is used in most imlementations of JVM (actually I do not know). The main aim was to achieve zero memory overhead per instance of class that implements interface.

The result is such that there are no any additional method table entries in the class instance for each interface implemented by a class, in contrast to a regular implementation of interfaces in C++.

The other goal is that the cast operation to or from interface returns the very same pointer of an object. An adress of interface is an address of an object.

How it works

In the Rotor all method tables are build purely dynamically. Each class has its primary method table and optionally set of additional method tables for interfaces. Rotor contains a sophisticated algorithm that maps each interface in an application domain to an entry in the table of additional class' method tables.

Share your thoughts with as about this article.

Copyright (c) 2003-2005 by Nesterovsky bros